﻿<?php
/**
 * Created by JetBrains PhpStorm.
 * User: Bezdelnick
 * Date: 24.04.13
 * Time: 9:11
 * To change this template use File | Settings | File Templates.
 */

require_once("Config.php");
require_once("dao/GenreDao.php");
require_once("dao/ActorDao.php");
require_once("dao/CountryDao.php");

$genreDao = new GenreDao();
$actorDao = new ActorDao();
$countryDao = new CountryDao();

$genres = $genreDao->load();
$actors = $actorDao->load();
$countries = $countryDao->load();

include("common/header.php");
?>

<div id="admin-navig-tabs">
    <ul>
        <li><a href="#tabs-1">Фильмы</a></li>
        <li><a href="#tabs-2">Новости</a></li>
    </ul>
    <div id="tabs-1">
        <form id="search_films_form" action="" method="post">
            <table class="content-table white-font">
                <tr>
                    <td colspan="1">Название</td>
                    <td colspan="2"><input type="text" name="film_name" style="width: 100%;" value=""/></td>
                </tr>
                <tr>
                    <td>Год выпуска (укажите диапазон)</td>
                    <td colspan="2"> С:&nbsp;
                        <select name="from_year">
                            <? for($year=2013; $year > 1950; $year--) { ?>
                            <option value="<?= $year ?>"> <?= $year ?> </option>
                            <? } ?>
                            <option value="1950" selected>1950</option>
                        </select>
                        по:&nbsp;
                        <select name="to_year">
                            <option value="2013" selected>2013</option>
                            <? for($year=2012; $year >= 1950; $year--) { ?>
                            <option value="<?= $year ?>"> <?= $year ?> </option>
                            <? } ?>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td style="width: 33%; vertical-align: top;">
                        <h2>Жанры</h2>
                        <? foreach ($genres as $genre) { ?>
                        <input
                                type="checkbox"
                                name="selected_genres[]"
                                value="<?= $genre->getId() ?>"
                                id="genre_<?= $genre->getId() ?>"/>
                        <label for="genre_<?= $genre->getId() ?>">
                            <?= $genre->getName() ?>
                        </label><br/>
                        <? } ?>
                    </td>


                    <td style="width: 33%; vertical-align: top;">
                        <h2>Актеры</h2>
                        <? foreach ($actors as $actor) { ?>
                        <input
                                type="checkbox"
                                name="selected_actors[]"
                                value="<?= $actor->getId() ?>"
                                id="actor_<?= $actor->getId() ?>"/>
                        <label for="actor_<?= $actor->getId() ?>">
                            <?= $actor->getFirstName() . " " . $actor->getLastName() ?>
                        </label><br/>
                        <? } ?>
                    </td>


                    <td style="width: 33%; vertical-align: top;">
                        <h2>Страны</h2>
                        <? foreach ($countries as $country) { ?>
                        <input
                                type="checkbox"
                                name="selected_countries[]"
                                value="<?= $country->getId() ?>"
                                id="country_<?= $country->getId() ?>"/>
                        <label for="country_<?= $country->getId() ?>">
                            <?= $country->getName() ?>
                        </label><br/>
                        <? } ?>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" style="text-align: right;">
                        <input type="button" value="Поиск"
                               class="jquery-button search-button"
                               contentContainerId="film_content_container"/>
                    </td>
                </tr>
            </table>
        </form>

        <div id="film_content_container"
             class="ajax-content-container" action="operations-search.php"></div>
    </div>
    <div id="tabs-2">
    </div>
</div>

<? include("common/footer.php") ?>